-- Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
--
-- this file licensed under the Mulan PSL v2.
-- You can use this software according to the terms and conditions of the Mulan PSL v2.
-- You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2
--
-- THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
-- PURPOSE.
-- See the Mulan PSL v2 for more details.
--
-- Author: auto generate
-- Create: 2025-9-3
-- Description: DO NOT EDIT; Code generated by "model.lua.mako"
local mdb = require 'mc.mdb'
local class = require 'mc.class_mgnt'
local privilege = require 'mc.privilege'

local hello_open_ubmc_class_types = require 'class.types.HelloOpenUBMC'
local my_eeprom_model_class_types = require 'class.types.MyEepromModel'
local community_intf_types = require 'Hello_openUBMC.json_types.Community'
local properties_intf_types = require 'Hello_openUBMC.json_types.Properties'
local reading_intf_types = require 'Hello_openUBMC.json_types.Reading'

local HelloOpenUBMC = {
    ['prop_configs'] = {['Health'] = {['baseType'] = 'U32', ['validator'] = hello_open_ubmc_class_types.Health}},
    ['default_props'] = {['Health'] = hello_open_ubmc_class_types.Health.default[1]},
    ['mdb_prop_configs'] = {
        ['bmc.kepler.OpenUBMC.Community'] = {
            ['WelcometoOpenUBMC'] = {['baseType'] = 'String', ['validator'] = community_intf_types.WelcometoOpenUBMC}
        },
        ['bmc.kepler.Object.Properties'] = {
            ['ClassName'] = {
                ['baseType'] = 'String',
                ['readOnly'] = true,
                ['validator'] = properties_intf_types.ClassName
            },
            ['ObjectName'] = {
                ['baseType'] = 'String',
                ['readOnly'] = true,
                ['validator'] = properties_intf_types.ObjectName
            },
            ['ObjectIdentifier'] = {
                ['baseType'] = 'Struct',
                ['$ref'] = '#/defs/StructIdentifier',
                ['readOnly'] = true,
                ['validator'] = properties_intf_types.ObjectIdentifier
            }
        }
    },
    ['mdb_classes'] = mdb.get_class_obj('/bmc/kepler/HelloOpenUBMC'),
    ['new_mdb_objects'] = mdb.new_objects_builder({
        ['bmc.kepler.OpenUBMC.Community'] = {
            ['property_defaults'] = {['WelcometoOpenUBMC'] = community_intf_types.WelcometoOpenUBMC.default[1]},
            ['interface_types'] = community_intf_types
        },
        ['bmc.kepler.Object.Properties'] = {
            ['property_defaults'] = {
                ['ClassName'] = properties_intf_types.ClassName.default[1],
                ['ObjectName'] = properties_intf_types.ObjectName.default[1],
                ['ObjectIdentifier'] = properties_intf_types.ObjectIdentifier.default[1]
            },
            ['interface_types'] = properties_intf_types
        }
    })
}

local MyCSRModel = {
    ['mdb_prop_configs'] = {
        ['bmc.demo.OpenUBMC.Reading'] = {
            ['TemperatureCelsius'] = {
                ['baseType'] = 'S16',
                ['descriptions'] = 'OpenUBMC示例中的温度读值',
                ['usage'] = {'CSR'},
                ['validator'] = reading_intf_types.TemperatureCelsius
            }
        },
        ['bmc.kepler.Object.Properties'] = {
            ['ClassName'] = {
                ['baseType'] = 'String',
                ['readOnly'] = true,
                ['validator'] = properties_intf_types.ClassName
            },
            ['ObjectName'] = {
                ['baseType'] = 'String',
                ['readOnly'] = true,
                ['validator'] = properties_intf_types.ObjectName
            },
            ['ObjectIdentifier'] = {
                ['baseType'] = 'Struct',
                ['$ref'] = '#/defs/StructIdentifier',
                ['readOnly'] = true,
                ['validator'] = properties_intf_types.ObjectIdentifier
            }
        }
    },
    ['mdb_classes'] = mdb.get_class_obj('/bmc/demo/MyCSRModel/:id'),
    ['new_mdb_objects'] = mdb.new_objects_builder({
        ['bmc.demo.OpenUBMC.Reading'] = {
            ['property_defaults'] = {['TemperatureCelsius'] = reading_intf_types.TemperatureCelsius.default[1]},
            ['interface_types'] = reading_intf_types
        },
        ['bmc.kepler.Object.Properties'] = {
            ['property_defaults'] = {
                ['ClassName'] = properties_intf_types.ClassName.default[1],
                ['ObjectName'] = properties_intf_types.ObjectName.default[1],
                ['ObjectIdentifier'] = properties_intf_types.ObjectIdentifier.default[1]
            },
            ['interface_types'] = properties_intf_types
        }
    })
}

local MyEepromModel = {
    ['prop_configs'] = {
        ['RefEepromTestChip'] = {
            ['usage'] = {'CSR'},
            ['baseType'] = 'U8[]',
            ['refInterface'] = 'bmc.kepler.Chip.BlockIO',
            ['validator'] = my_eeprom_model_class_types.RefEepromTestChip
        }
    },
    ['default_props'] = {['RefEepromTestChip'] = my_eeprom_model_class_types.RefEepromTestChip.default[1]}
}

local M = {}

function M.init(bus)
    class('HelloOpenUBMC', HelloOpenUBMC):set_bus(bus)
    class('MyCSRModel', MyCSRModel):set_bus(bus)
    class('MyEepromModel', MyEepromModel):set_bus(bus)
end
return M
